﻿using System.Linq;
using StockholmsStad.Data.Entity;

namespace StockholmsStad.Data
{
    /// <summary>
    /// Implementation av interfacet IDataContextGeneric
    /// </summary>
    internal class DataContextTest : IDataContextTest
    {
        #region IDataContextTest Members

        public Address GetAddressById(int id)
        {
            var context = new StockholmsStadDataTablesContext();
            Address address = (from a in context.Addresses
                               where a.AddressId == id
                               select a).SingleOrDefault();
            return address;
        }

        public Person GetPersonById(int id)
        {
            var context = new StockholmsStadDataTablesContext();
            Person address = (from a in context.Persons
                              where a.PersonId == id
                              select a).SingleOrDefault();
            return address;
        }

        public UserLogin GetUserByCoupleId(int coupleId)
        {
            var context = new StockholmsStadDataTablesContext();
            UserLogin returnValue = (from a in context.UserLogins
                                     where a.CoupleId == coupleId
                                     select a).SingleOrDefault();
            return returnValue;
        }

        #endregion
    }
}